const getUserState = () => {
    return JSON.parse(sessionStorage.getItem("user_state"));
}

const setUserState = (value) => {
    sessionStorage.setItem("user_state", JSON.stringify(value));
}

const getUserInfo = () => {
    if (JSON.parse(sessionStorage.getItem("user_info"))) {
        if (JSON.parse(sessionStorage.getItem("user_info")).length > 0) {
            return JSON.parse(sessionStorage.getItem("user_info"))[0];
        } else {
            return JSON.parse(sessionStorage.getItem("user_info"));
        }
    }
}

const setUserInfo = (value) => {
    console.log(value)
    sessionStorage.setItem("user_info", JSON.stringify(value));
}

const getPasswordStorage = () => {
    return sessionStorage.getItem("password")
}

const setPasswordStorage = (state) => {
    sessionStorage.setItem("password", state);
}


export {
    getUserState,
    setUserState,
    getUserInfo,
    setUserInfo,
    getPasswordStorage,
    setPasswordStorage
}
